\(\int \frac {1}{(a+b \cot ^2(c+d x))^3} \, dx\) [7]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 14, antiderivative size = 150 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=\frac {x}{(a-b)^3}+\frac {\sqrt {b} \left (15 a^2-10 a b+3 b^2\right ) \arctan \left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{8 a^{5/2} (a-b)^3 d}+\frac {b \cot (c+d x)}{4 a (a-b) d \left (a+b \cot ^2(c+d x)\right )^2}+\frac {(7 a-3 b) b \cot (c+d x)}{8 a^2 (a-b)^2 d \left (a+b \cot ^2(c+d x)\right )} \]

[Out]

x/(a-b)^3+1/4*b*cot(d*x+c)/a/(a-b)/d/(a+b*cot(d*x+c)^2)^2+1/8*(7*a-3*b)*b*cot(d*x+c)/a^2/(a-b)^2/d/(a+b*cot(d*
x+c)^2)+1/8*(15*a^2-10*a*b+3*b^2)*arctan(cot(d*x+c)*b^(1/2)/a^(1/2))*b^(1/2)/a^(5/2)/(a-b)^3/d

Rubi [A] (verified)

Time = 0.19 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {3742, 425, 541, 536, 209, 211} \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=\frac {b (7 a-3 b) \cot (c+d x)}{8 a^2 d (a-b)^2 \left (a+b \cot ^2(c+d x)\right )}+\frac {\sqrt {b} \left (15 a^2-10 a b+3 b^2\right ) \arctan \left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{8 a^{5/2} d (a-b)^3}+\frac {b \cot (c+d x)}{4 a d (a-b) \left (a+b \cot ^2(c+d x)\right )^2}+\frac {x}{(a-b)^3} \]

[In]

Int[(a + b*Cot[c + d*x]^2)^(-3),x]

[Out]

x/(a - b)^3 + (Sqrt[b]*(15*a^2 - 10*a*b + 3*b^2)*ArcTan[(Sqrt[b]*Cot[c + d*x])/Sqrt[a]])/(8*a^(5/2)*(a - b)^3*
d) + (b*Cot[c + d*x])/(4*a*(a - b)*d*(a + b*Cot[c + d*x]^2)^2) + ((7*a - 3*b)*b*Cot[c + d*x])/(8*a^2*(a - b)^2
*d*(a + b*Cot[c + d*x]^2))

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 425

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[(-b)*x*(a + b*x^n)^(p + 1)*
((c + d*x^n)^(q + 1)/(a*n*(p + 1)*(b*c - a*d))), x] + Dist[1/(a*n*(p + 1)*(b*c - a*d)), Int[(a + b*x^n)^(p + 1
)*(c + d*x^n)^q*Simp[b*c + n*(p + 1)*(b*c - a*d) + d*b*(n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c,
d, n, q}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] &&  !( !IntegerQ[p] && IntegerQ[q] && LtQ[q, -1]) && IntBinomi
alQ[a, b, c, d, n, p, q, x]

Rule 536

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 541

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_.)*((e_) + (f_.)*(x_)^(n_)), x_Symbol] :> Simp[(
-(b*e - a*f))*x*(a + b*x^n)^(p + 1)*((c + d*x^n)^(q + 1)/(a*n*(b*c - a*d)*(p + 1))), x] + Dist[1/(a*n*(b*c - a
*d)*(p + 1)), Int[(a + b*x^n)^(p + 1)*(c + d*x^n)^q*Simp[c*(b*e - a*f) + e*n*(b*c - a*d)*(p + 1) + d*(b*e - a*
f)*(n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, f, n, q}, x] && LtQ[p, -1]

Rule 3742

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[c*(ff/f), Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \left (a+b x^2\right )^3} \, dx,x,\cot (c+d x)\right )}{d} \\ & = \frac {b \cot (c+d x)}{4 a (a-b) d \left (a+b \cot ^2(c+d x)\right )^2}-\frac {\text {Subst}\left (\int \frac {4 a-3 b-3 b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{4 a (a-b) d} \\ & = \frac {b \cot (c+d x)}{4 a (a-b) d \left (a+b \cot ^2(c+d x)\right )^2}+\frac {(7 a-3 b) b \cot (c+d x)}{8 a^2 (a-b)^2 d \left (a+b \cot ^2(c+d x)\right )}-\frac {\text {Subst}\left (\int \frac {8 a^2-7 a b+3 b^2-(7 a-3 b) b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\cot (c+d x)\right )}{8 a^2 (a-b)^2 d} \\ & = \frac {b \cot (c+d x)}{4 a (a-b) d \left (a+b \cot ^2(c+d x)\right )^2}+\frac {(7 a-3 b) b \cot (c+d x)}{8 a^2 (a-b)^2 d \left (a+b \cot ^2(c+d x)\right )}-\frac {\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{(a-b)^3 d}+\frac {\left (b \left (15 a^2-10 a b+3 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\cot (c+d x)\right )}{8 a^2 (a-b)^3 d} \\ & = \frac {x}{(a-b)^3}+\frac {\sqrt {b} \left (15 a^2-10 a b+3 b^2\right ) \arctan \left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{8 a^{5/2} (a-b)^3 d}+\frac {b \cot (c+d x)}{4 a (a-b) d \left (a+b \cot ^2(c+d x)\right )^2}+\frac {(7 a-3 b) b \cot (c+d x)}{8 a^2 (a-b)^2 d \left (a+b \cot ^2(c+d x)\right )} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.35 (sec) , antiderivative size = 138, normalized size of antiderivative = 0.92 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=\frac {-8 \arctan (\cot (c+d x))+\frac {\sqrt {b} \left (15 a^2-10 a b+3 b^2\right ) \arctan \left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{a^{5/2}}+\frac {2 (a-b)^2 b \cot (c+d x)}{a \left (a+b \cot ^2(c+d x)\right )^2}+\frac {(7 a-3 b) (a-b) b \cot (c+d x)}{a^2 \left (a+b \cot ^2(c+d x)\right )}}{8 (a-b)^3 d} \]

[In]

Integrate[(a + b*Cot[c + d*x]^2)^(-3),x]

[Out]

(-8*ArcTan[Cot[c + d*x]] + (Sqrt[b]*(15*a^2 - 10*a*b + 3*b^2)*ArcTan[(Sqrt[b]*Cot[c + d*x])/Sqrt[a]])/a^(5/2)
+ (2*(a - b)^2*b*Cot[c + d*x])/(a*(a + b*Cot[c + d*x]^2)^2) + ((7*a - 3*b)*(a - b)*b*Cot[c + d*x])/(a^2*(a + b
*Cot[c + d*x]^2)))/(8*(a - b)^3*d)

Maple [A] (verified)

Time = 0.21 (sec) , antiderivative size = 148, normalized size of antiderivative = 0.99

method result size
derivativedivides \(\frac {-\frac {\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )}{\left (a -b \right )^{3}}+\frac {b \left (\frac {\frac {b \left (7 a^{2}-10 a b +3 b^{2}\right ) \cot \left (d x +c \right )^{3}}{8 a^{2}}+\frac {\left (9 a^{2}-14 a b +5 b^{2}\right ) \cot \left (d x +c \right )}{8 a}}{\left (a +b \cot \left (d x +c \right )^{2}\right )^{2}}+\frac {\left (15 a^{2}-10 a b +3 b^{2}\right ) \arctan \left (\frac {b \cot \left (d x +c \right )}{\sqrt {a b}}\right )}{8 a^{2} \sqrt {a b}}\right )}{\left (a -b \right )^{3}}}{d}\) \(148\)
default \(\frac {-\frac {\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )}{\left (a -b \right )^{3}}+\frac {b \left (\frac {\frac {b \left (7 a^{2}-10 a b +3 b^{2}\right ) \cot \left (d x +c \right )^{3}}{8 a^{2}}+\frac {\left (9 a^{2}-14 a b +5 b^{2}\right ) \cot \left (d x +c \right )}{8 a}}{\left (a +b \cot \left (d x +c \right )^{2}\right )^{2}}+\frac {\left (15 a^{2}-10 a b +3 b^{2}\right ) \arctan \left (\frac {b \cot \left (d x +c \right )}{\sqrt {a b}}\right )}{8 a^{2} \sqrt {a b}}\right )}{\left (a -b \right )^{3}}}{d}\) \(148\)
risch \(\frac {x}{a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}}-\frac {i b \left (9 a^{3} {\mathrm e}^{6 i \left (d x +c \right )}+a^{2} b \,{\mathrm e}^{6 i \left (d x +c \right )}-13 a \,b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+3 b^{3} {\mathrm e}^{6 i \left (d x +c \right )}-27 a^{3} {\mathrm e}^{4 i \left (d x +c \right )}-9 a^{2} b \,{\mathrm e}^{4 i \left (d x +c \right )}-21 a \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+9 b^{3} {\mathrm e}^{4 i \left (d x +c \right )}+27 a^{3} {\mathrm e}^{2 i \left (d x +c \right )}-13 a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}-23 a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+9 b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-9 a^{3}+21 a^{2} b -15 a \,b^{2}+3 b^{3}\right )}{4 \left (-a \,{\mathrm e}^{4 i \left (d x +c \right )}+b \,{\mathrm e}^{4 i \left (d x +c \right )}+2 \,{\mathrm e}^{2 i \left (d x +c \right )} a +2 \,{\mathrm e}^{2 i \left (d x +c \right )} b -a +b \right )^{2} \left (-a +b \right ) \left (a^{2}-2 a b +b^{2}\right ) a^{2} d}+\frac {15 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a b}+a +b}{a -b}\right )}{16 a \left (a -b \right )^{3} d}-\frac {5 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a b}+a +b}{a -b}\right ) b}{8 a^{2} \left (a -b \right )^{3} d}+\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a b}+a +b}{a -b}\right ) b^{2}}{16 a^{3} \left (a -b \right )^{3} d}-\frac {15 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a b}-a -b}{a -b}\right )}{16 a \left (a -b \right )^{3} d}+\frac {5 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a b}-a -b}{a -b}\right ) b}{8 a^{2} \left (a -b \right )^{3} d}-\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a b}-a -b}{a -b}\right ) b^{2}}{16 a^{3} \left (a -b \right )^{3} d}\) \(642\)

[In]

int(1/(a+b*cot(d*x+c)^2)^3,x,method=_RETURNVERBOSE)

[Out]

1/d*(-1/(a-b)^3*(1/2*Pi-arccot(cot(d*x+c)))+b/(a-b)^3*((1/8*b*(7*a^2-10*a*b+3*b^2)/a^2*cot(d*x+c)^3+1/8*(9*a^2
-14*a*b+5*b^2)/a*cot(d*x+c))/(a+b*cot(d*x+c)^2)^2+1/8*(15*a^2-10*a*b+3*b^2)/a^2/(a*b)^(1/2)*arctan(b*cot(d*x+c
)/(a*b)^(1/2))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 475 vs. \(2 (136) = 272\).

Time = 0.33 (sec) , antiderivative size = 1068, normalized size of antiderivative = 7.12 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=\text {Too large to display} \]

[In]

integrate(1/(a+b*cot(d*x+c)^2)^3,x, algorithm="fricas")

[Out]

[1/32*(32*(a^4 - 2*a^3*b + a^2*b^2)*d*x*cos(2*d*x + 2*c)^2 - 64*(a^4 - a^2*b^2)*d*x*cos(2*d*x + 2*c) + 32*(a^4
 + 2*a^3*b + a^2*b^2)*d*x - (15*a^4 + 20*a^3*b - 2*a^2*b^2 - 4*a*b^3 + 3*b^4 + (15*a^4 - 40*a^3*b + 38*a^2*b^2
 - 16*a*b^3 + 3*b^4)*cos(2*d*x + 2*c)^2 - 2*(15*a^4 - 10*a^3*b - 12*a^2*b^2 + 10*a*b^3 - 3*b^4)*cos(2*d*x + 2*
c))*sqrt(-b/a)*log(((a^2 + 6*a*b + b^2)*cos(2*d*x + 2*c)^2 + 4*(a^2 - a*b - (a^2 + a*b)*cos(2*d*x + 2*c))*sqrt
(-b/a)*sin(2*d*x + 2*c) + a^2 - 6*a*b + b^2 - 2*(a^2 - b^2)*cos(2*d*x + 2*c))/((a^2 - 2*a*b + b^2)*cos(2*d*x +
 2*c)^2 + a^2 + 2*a*b + b^2 - 2*(a^2 - b^2)*cos(2*d*x + 2*c))) + 4*(9*a^3*b - 7*a^2*b^2 - 5*a*b^3 + 3*b^4 - 3*
(3*a^3*b - 7*a^2*b^2 + 5*a*b^3 - b^4)*cos(2*d*x + 2*c))*sin(2*d*x + 2*c))/((a^7 - 5*a^6*b + 10*a^5*b^2 - 10*a^
4*b^3 + 5*a^3*b^4 - a^2*b^5)*d*cos(2*d*x + 2*c)^2 - 2*(a^7 - 3*a^6*b + 2*a^5*b^2 + 2*a^4*b^3 - 3*a^3*b^4 + a^2
*b^5)*d*cos(2*d*x + 2*c) + (a^7 - a^6*b - 2*a^5*b^2 + 2*a^4*b^3 + a^3*b^4 - a^2*b^5)*d), 1/16*(16*(a^4 - 2*a^3
*b + a^2*b^2)*d*x*cos(2*d*x + 2*c)^2 - 32*(a^4 - a^2*b^2)*d*x*cos(2*d*x + 2*c) + 16*(a^4 + 2*a^3*b + a^2*b^2)*
d*x + (15*a^4 + 20*a^3*b - 2*a^2*b^2 - 4*a*b^3 + 3*b^4 + (15*a^4 - 40*a^3*b + 38*a^2*b^2 - 16*a*b^3 + 3*b^4)*c
os(2*d*x + 2*c)^2 - 2*(15*a^4 - 10*a^3*b - 12*a^2*b^2 + 10*a*b^3 - 3*b^4)*cos(2*d*x + 2*c))*sqrt(b/a)*arctan(1
/2*((a + b)*cos(2*d*x + 2*c) - a + b)*sqrt(b/a)/(b*sin(2*d*x + 2*c))) + 2*(9*a^3*b - 7*a^2*b^2 - 5*a*b^3 + 3*b
^4 - 3*(3*a^3*b - 7*a^2*b^2 + 5*a*b^3 - b^4)*cos(2*d*x + 2*c))*sin(2*d*x + 2*c))/((a^7 - 5*a^6*b + 10*a^5*b^2
- 10*a^4*b^3 + 5*a^3*b^4 - a^2*b^5)*d*cos(2*d*x + 2*c)^2 - 2*(a^7 - 3*a^6*b + 2*a^5*b^2 + 2*a^4*b^3 - 3*a^3*b^
4 + a^2*b^5)*d*cos(2*d*x + 2*c) + (a^7 - a^6*b - 2*a^5*b^2 + 2*a^4*b^3 + a^3*b^4 - a^2*b^5)*d)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 8964 vs. \(2 (133) = 266\).

Time = 48.20 (sec) , antiderivative size = 8964, normalized size of antiderivative = 59.76 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=\text {Too large to display} \]

[In]

integrate(1/(a+b*cot(d*x+c)**2)**3,x)

[Out]

Piecewise((zoo*x/cot(c)**6, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (x/a**3, Eq(b, 0)), ((-x + 1/(d*cot(c + d*x)) - 1
/(3*d*cot(c + d*x)**3) + 1/(5*d*cot(c + d*x)**5))/b**3, Eq(a, 0)), (15*d*x*cot(c + d*x)**6/(48*b**3*d*cot(c +
d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)**2 + 48*b**3*d) + 45*d*x*cot(c + d*x)**4/(48*b*
*3*d*cot(c + d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)**2 + 48*b**3*d) + 45*d*x*cot(c + d
*x)**2/(48*b**3*d*cot(c + d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)**2 + 48*b**3*d) + 15*
d*x/(48*b**3*d*cot(c + d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)**2 + 48*b**3*d) - 15*cot
(c + d*x)**5/(48*b**3*d*cot(c + d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)**2 + 48*b**3*d)
 - 40*cot(c + d*x)**3/(48*b**3*d*cot(c + d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)**2 + 4
8*b**3*d) - 33*cot(c + d*x)/(48*b**3*d*cot(c + d*x)**6 + 144*b**3*d*cot(c + d*x)**4 + 144*b**3*d*cot(c + d*x)*
*2 + 48*b**3*d), Eq(a, b)), (x/(a + b*cot(c)**2)**3, Eq(d, 0)), (16*a**4*d*x*sqrt(-a/b)/(16*a**7*d*sqrt(-a/b)
+ 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4
- 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*
x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(
c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 15*a**4
*log(-sqrt(-a/b) + cot(c + d*x))/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*
sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b
**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*
a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2
 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 15*a**4*log(sqrt(-a/b) + cot(c + d*x))/(16*a**7*d*sqrt(-a/b) +
 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 -
 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x
)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c
 + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 32*a**3*
b*d*x*sqrt(-a/b)*cot(c + d*x)**2/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*
sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b
**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*
a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2
 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 18*a**3*b*sqrt(-a/b)*cot(c + d*x)/(16*a**7*d*sqrt(-a/b) + 32*a
**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a
**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4
+ 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*
x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 30*a**3*b*log
(-sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**2/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 -
48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2
 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d
*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot
(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 10*a**3*b*log(-sqrt(-a/b) + cot(c + d*x))/(16*a**7
*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*co
t(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a
/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*s
qrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)
**4) - 30*a**3*b*log(sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**2/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)
*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a
/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*s
qrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b*
*4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 10*a**3*b*log(sqrt(-a/b) + cot(
c + d*x))/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b*
*2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a
**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b)
+ 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(
-a/b)*cot(c + d*x)**4) + 16*a**2*b**2*d*x*sqrt(-a/b)*cot(c + d*x)**4/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(
-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sq
rt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**
3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a*
*3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 14*a**2*b**2*sqrt(-a/b)*co
t(c + d*x)**3/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**
5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) -
48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a
/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*s
qrt(-a/b)*cot(c + d*x)**4) - 28*a**2*b**2*sqrt(-a/b)*cot(c + d*x)/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/
b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(
-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d
*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*
b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 15*a**2*b**2*log(-sqrt(-a/b)
+ cot(c + d*x))*cot(c + d*x)**4/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*s
qrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b*
*2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a
**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2
- 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 20*a**2*b**2*log(-sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**2/(1
6*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a
/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*s
qrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b*
*4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c
+ d*x)**4) + 3*a**2*b**2*log(-sqrt(-a/b) + cot(c + d*x))/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c
+ d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot
(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/
b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sq
rt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 15*a**2*b**2*log(sqrt(-a/b) + cot(c +
d*x))*cot(c + d*x)**4/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b)
+ 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(
-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d
*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*
b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 20*a**2*b**2*log(sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**2/(16*a**7*d*sq
rt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c +
 d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*c
ot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-
a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4)
- 3*a**2*b**2*log(sqrt(-a/b) + cot(c + d*x))/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 -
48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2
 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d
*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot
(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 20*a*b**3*sqrt(-a/b)*cot(c + d*x)**3/(16*a**7*d*sq
rt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c +
 d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*c
ot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-
a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4)
+ 10*a*b**3*sqrt(-a/b)*cot(c + d*x)/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b
*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**
5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 -
16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)
**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 10*a*b**3*log(-sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**4/(
16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-
a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*
sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b
**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c
 + d*x)**4) + 6*a*b**3*log(-sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**2/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqr
t(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*
sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b
**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*
a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 10*a*b**3*log(sqrt(-a/b)
 + cot(c + d*x))*cot(c + d*x)**4/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*
sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b
**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*
a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2
 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) - 6*a*b**3*log(sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**2/(16*a*
*7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*
cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(
-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d
*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*
x)**4) + 6*b**4*sqrt(-a/b)*cot(c + d*x)**3/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48
*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 +
 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x
)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c
 + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4) + 3*b**4*log(-sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)*
*4/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sqrt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sq
rt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**
3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a*
*3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*c
ot(c + d*x)**4) - 3*b**4*log(sqrt(-a/b) + cot(c + d*x))*cot(c + d*x)**4/(16*a**7*d*sqrt(-a/b) + 32*a**6*b*d*sq
rt(-a/b)*cot(c + d*x)**2 - 48*a**6*b*d*sqrt(-a/b) + 16*a**5*b**2*d*sqrt(-a/b)*cot(c + d*x)**4 - 96*a**5*b**2*d
*sqrt(-a/b)*cot(c + d*x)**2 + 48*a**5*b**2*d*sqrt(-a/b) - 48*a**4*b**3*d*sqrt(-a/b)*cot(c + d*x)**4 + 96*a**4*
b**3*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**4*b**3*d*sqrt(-a/b) + 48*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**4 - 32
*a**3*b**4*d*sqrt(-a/b)*cot(c + d*x)**2 - 16*a**2*b**5*d*sqrt(-a/b)*cot(c + d*x)**4), True))

Maxima [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 228, normalized size of antiderivative = 1.52 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=-\frac {\frac {{\left (15 \, a^{2} b - 10 \, a b^{2} + 3 \, b^{3}\right )} \arctan \left (\frac {a \tan \left (d x + c\right )}{\sqrt {a b}}\right )}{{\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} \sqrt {a b}} - \frac {{\left (9 \, a^{2} b - 5 \, a b^{2}\right )} \tan \left (d x + c\right )^{3} + {\left (7 \, a b^{2} - 3 \, b^{3}\right )} \tan \left (d x + c\right )}{a^{4} b^{2} - 2 \, a^{3} b^{3} + a^{2} b^{4} + {\left (a^{6} - 2 \, a^{5} b + a^{4} b^{2}\right )} \tan \left (d x + c\right )^{4} + 2 \, {\left (a^{5} b - 2 \, a^{4} b^{2} + a^{3} b^{3}\right )} \tan \left (d x + c\right )^{2}} - \frac {8 \, {\left (d x + c\right )}}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}}}{8 \, d} \]

[In]

integrate(1/(a+b*cot(d*x+c)^2)^3,x, algorithm="maxima")

[Out]

-1/8*((15*a^2*b - 10*a*b^2 + 3*b^3)*arctan(a*tan(d*x + c)/sqrt(a*b))/((a^5 - 3*a^4*b + 3*a^3*b^2 - a^2*b^3)*sq
rt(a*b)) - ((9*a^2*b - 5*a*b^2)*tan(d*x + c)^3 + (7*a*b^2 - 3*b^3)*tan(d*x + c))/(a^4*b^2 - 2*a^3*b^3 + a^2*b^
4 + (a^6 - 2*a^5*b + a^4*b^2)*tan(d*x + c)^4 + 2*(a^5*b - 2*a^4*b^2 + a^3*b^3)*tan(d*x + c)^2) - 8*(d*x + c)/(
a^3 - 3*a^2*b + 3*a*b^2 - b^3))/d

Giac [A] (verification not implemented)

none

Time = 0.40 (sec) , antiderivative size = 206, normalized size of antiderivative = 1.37 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=-\frac {\frac {{\left (15 \, a^{2} b - 10 \, a b^{2} + 3 \, b^{3}\right )} {\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (d x + c\right )}{\sqrt {a b}}\right )\right )}}{{\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} \sqrt {a b}} - \frac {8 \, {\left (d x + c\right )}}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} - \frac {9 \, a^{2} b \tan \left (d x + c\right )^{3} - 5 \, a b^{2} \tan \left (d x + c\right )^{3} + 7 \, a b^{2} \tan \left (d x + c\right ) - 3 \, b^{3} \tan \left (d x + c\right )}{{\left (a^{4} - 2 \, a^{3} b + a^{2} b^{2}\right )} {\left (a \tan \left (d x + c\right )^{2} + b\right )}^{2}}}{8 \, d} \]

[In]

integrate(1/(a+b*cot(d*x+c)^2)^3,x, algorithm="giac")

[Out]

-1/8*((15*a^2*b - 10*a*b^2 + 3*b^3)*(pi*floor((d*x + c)/pi + 1/2)*sgn(a) + arctan(a*tan(d*x + c)/sqrt(a*b)))/(
(a^5 - 3*a^4*b + 3*a^3*b^2 - a^2*b^3)*sqrt(a*b)) - 8*(d*x + c)/(a^3 - 3*a^2*b + 3*a*b^2 - b^3) - (9*a^2*b*tan(
d*x + c)^3 - 5*a*b^2*tan(d*x + c)^3 + 7*a*b^2*tan(d*x + c) - 3*b^3*tan(d*x + c))/((a^4 - 2*a^3*b + a^2*b^2)*(a
*tan(d*x + c)^2 + b)^2))/d

Mupad [B] (verification not implemented)

Time = 16.09 (sec) , antiderivative size = 4866, normalized size of antiderivative = 32.44 \[ \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^3} \, dx=\text {Too large to display} \]

[In]

int(1/(a + b*cot(c + d*x)^2)^3,x)

[Out]

((cot(c + d*x)^3*(7*a*b^2 - 3*b^3))/(8*a^2*(a^2 - 2*a*b + b^2)) + (cot(c + d*x)*(9*a*b - 5*b^2))/(8*a*(a^2 - 2
*a*b + b^2)))/(a^2*d + b^2*d*cot(c + d*x)^4 + 2*a*b*d*cot(c + d*x)^2) + (2*atan((((((96*a^2*b^10*d^2 - 800*a^3
*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a^6*b^6*d^2 - 9056*a^7*b^5*d^2 + 5280*a^8*b^4*d^2 - 1760
*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*b*d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 -
20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) - (cot(c + d*x)*(256*a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 128
0*a^7*b^6*d^2 - 1280*a^8*b^5*d^2 + 2304*a^9*b^4*d^2 - 1280*a^10*b^3*d^2 + 256*a^11*b^2*d^2)*1i)/(32*(2*a^3*d -
 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d)*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*1i)/
(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d) - (cot(c + d*x)*(9*b^7 - 60*a*b^6 + 190*a^2*b^5 - 300*a^3*b^4 + 28
9*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))/(2*a^3*d - 2*b^3*d + 6
*a*b^2*d - 6*a^2*b*d) - ((((96*a^2*b^10*d^2 - 800*a^3*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a^6
*b^6*d^2 - 9056*a^7*b^5*d^2 + 5280*a^8*b^4*d^2 - 1760*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*b*
d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) + (cot(c + d*x)*(256*a^
4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a^7*b^6*d^2 - 1280*a^8*b^5*d^2 + 2304*a^9*b^4*d^2 - 128
0*a^10*b^3*d^2 + 256*a^11*b^2*d^2)*1i)/(32*(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d)*(a^8*d^2 - 4*a^7*b*d^2
+ a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*1i)/(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d) + (cot(c + d*
x)*(9*b^7 - 60*a*b^6 + 190*a^2*b^5 - 300*a^3*b^4 + 289*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*
a^5*b^3*d^2 + 6*a^6*b^2*d^2)))/(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d))/((((((96*a^2*b^10*d^2 - 800*a^3*b^
9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a^6*b^6*d^2 - 9056*a^7*b^5*d^2 + 5280*a^8*b^4*d^2 - 1760*a^
9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*b*d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*
a^7*b^3*d^3 + 15*a^8*b^2*d^3)) - (cot(c + d*x)*(256*a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a
^7*b^6*d^2 - 1280*a^8*b^5*d^2 + 2304*a^9*b^4*d^2 - 1280*a^10*b^3*d^2 + 256*a^11*b^2*d^2)*1i)/(32*(2*a^3*d - 2*
b^3*d + 6*a*b^2*d - 6*a^2*b*d)*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*1i)/(2*
a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d) - (cot(c + d*x)*(9*b^7 - 60*a*b^6 + 190*a^2*b^5 - 300*a^3*b^4 + 289*a
^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*1i)/(2*a^3*d - 2*b^3*d +
6*a*b^2*d - 6*a^2*b*d) + (((((96*a^2*b^10*d^2 - 800*a^3*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a
^6*b^6*d^2 - 9056*a^7*b^5*d^2 + 5280*a^8*b^4*d^2 - 1760*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*
b*d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) + (cot(c + d*x)*(256*
a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a^7*b^6*d^2 - 1280*a^8*b^5*d^2 + 2304*a^9*b^4*d^2 - 1
280*a^10*b^3*d^2 + 256*a^11*b^2*d^2)*1i)/(32*(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d)*(a^8*d^2 - 4*a^7*b*d^
2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*1i)/(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d) + (cot(c +
d*x)*(9*b^7 - 60*a*b^6 + 190*a^2*b^5 - 300*a^3*b^4 + 289*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 -
4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*1i)/(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d) + (51*a*b^5 - 9*b^6 - 115*a^2
*b^4 + 105*a^3*b^3)/(32*(a^10*d^3 - 6*a^9*b*d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^
3 + 15*a^8*b^2*d^3)))))/(2*a^3*d - 2*b^3*d + 6*a*b^2*d - 6*a^2*b*d) - (atan((((-a^5*b)^(1/2)*((cot(c + d*x)*(9
*b^7 - 60*a*b^6 + 190*a^2*b^5 - 300*a^3*b^4 + 289*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b
^3*d^2 + 6*a^6*b^2*d^2)) - (((96*a^2*b^10*d^2 - 800*a^3*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a
^6*b^6*d^2 - 9056*a^7*b^5*d^2 + 5280*a^8*b^4*d^2 - 1760*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*
b*d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) - (cot(c + d*x)*(-a^5
*b)^(1/2)*(15*a^2 - 10*a*b + 3*b^2)*(256*a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a^7*b^6*d^2
- 1280*a^8*b^5*d^2 + 2304*a^9*b^4*d^2 - 1280*a^10*b^3*d^2 + 256*a^11*b^2*d^2))/(512*(a^8*d - a^5*b^3*d + 3*a^6
*b^2*d - 3*a^7*b*d)*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*(-a^5*b)^(1/2)*(15
*a^2 - 10*a*b + 3*b^2))/(16*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)))*(15*a^2 - 10*a*b + 3*b^2)*1i)/(16*
(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)) + ((-a^5*b)^(1/2)*((cot(c + d*x)*(9*b^7 - 60*a*b^6 + 190*a^2*b^
5 - 300*a^3*b^4 + 289*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)) + (
((96*a^2*b^10*d^2 - 800*a^3*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a^6*b^6*d^2 - 9056*a^7*b^5*d^
2 + 5280*a^8*b^4*d^2 - 1760*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*b*d^3 + a^4*b^6*d^3 - 6*a^5*
b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) + (cot(c + d*x)*(-a^5*b)^(1/2)*(15*a^2 - 10*a*b +
 3*b^2)*(256*a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a^7*b^6*d^2 - 1280*a^8*b^5*d^2 + 2304*a^
9*b^4*d^2 - 1280*a^10*b^3*d^2 + 256*a^11*b^2*d^2))/(512*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)*(a^8*d^2
 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*(-a^5*b)^(1/2)*(15*a^2 - 10*a*b + 3*b^2))/(16*
(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)))*(15*a^2 - 10*a*b + 3*b^2)*1i)/(16*(a^8*d - a^5*b^3*d + 3*a^6*b
^2*d - 3*a^7*b*d)))/((51*a*b^5 - 9*b^6 - 115*a^2*b^4 + 105*a^3*b^3)/(32*(a^10*d^3 - 6*a^9*b*d^3 + a^4*b^6*d^3
- 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) - ((-a^5*b)^(1/2)*((cot(c + d*x)*(9*b^7 -
 60*a*b^6 + 190*a^2*b^5 - 300*a^3*b^4 + 289*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2
 + 6*a^6*b^2*d^2)) - (((96*a^2*b^10*d^2 - 800*a^3*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a^6*b^6
*d^2 - 9056*a^7*b^5*d^2 + 5280*a^8*b^4*d^2 - 1760*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*b*d^3
+ a^4*b^6*d^3 - 6*a^5*b^5*d^3 + 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) - (cot(c + d*x)*(-a^5*b)^(1
/2)*(15*a^2 - 10*a*b + 3*b^2)*(256*a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a^7*b^6*d^2 - 1280
*a^8*b^5*d^2 + 2304*a^9*b^4*d^2 - 1280*a^10*b^3*d^2 + 256*a^11*b^2*d^2))/(512*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d
 - 3*a^7*b*d)*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*(-a^5*b)^(1/2)*(15*a^2 -
 10*a*b + 3*b^2))/(16*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)))*(15*a^2 - 10*a*b + 3*b^2))/(16*(a^8*d -
a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)) + ((-a^5*b)^(1/2)*((cot(c + d*x)*(9*b^7 - 60*a*b^6 + 190*a^2*b^5 - 300*a
^3*b^4 + 289*a^4*b^3))/(32*(a^8*d^2 - 4*a^7*b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)) + (((96*a^2*
b^10*d^2 - 800*a^3*b^9*d^2 + 3040*a^4*b^8*d^2 - 6816*a^5*b^7*d^2 + 9760*a^6*b^6*d^2 - 9056*a^7*b^5*d^2 + 5280*
a^8*b^4*d^2 - 1760*a^9*b^3*d^2 + 256*a^10*b^2*d^2)/(64*(a^10*d^3 - 6*a^9*b*d^3 + a^4*b^6*d^3 - 6*a^5*b^5*d^3 +
 15*a^6*b^4*d^3 - 20*a^7*b^3*d^3 + 15*a^8*b^2*d^3)) + (cot(c + d*x)*(-a^5*b)^(1/2)*(15*a^2 - 10*a*b + 3*b^2)*(
256*a^4*b^9*d^2 - 1280*a^5*b^8*d^2 + 2304*a^6*b^7*d^2 - 1280*a^7*b^6*d^2 - 1280*a^8*b^5*d^2 + 2304*a^9*b^4*d^2
 - 1280*a^10*b^3*d^2 + 256*a^11*b^2*d^2))/(512*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)*(a^8*d^2 - 4*a^7*
b*d^2 + a^4*b^4*d^2 - 4*a^5*b^3*d^2 + 6*a^6*b^2*d^2)))*(-a^5*b)^(1/2)*(15*a^2 - 10*a*b + 3*b^2))/(16*(a^8*d -
a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d)))*(15*a^2 - 10*a*b + 3*b^2))/(16*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7
*b*d))))*(-a^5*b)^(1/2)*(15*a^2 - 10*a*b + 3*b^2)*1i)/(8*(a^8*d - a^5*b^3*d + 3*a^6*b^2*d - 3*a^7*b*d))